import 'package:flutter/material.dart';
import 'package:txtest/cache.dart';

class LogoutPage extends StatelessWidget{
  
  logout(BuildContext context){
    setUserToken("");
    goHomePage(context);
  }

  goHomePage(BuildContext context){
    Navigator.pushNamedAndRemoveUntil(context, "/",(Route<dynamic> route) => false);
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("注销"),
      ),
      body: new Center(
        child: RaisedButton(
          onPressed: (){
            logout(context);
          },
          child: Text('退出'),
        )
      ),
    );
  }

}
